package com.qfedu.empproject.service.impl;

import com.qfedu.empproject.dao.EmpDao;
import com.qfedu.empproject.dao.impl.EmpDaoImpl;
import com.qfedu.empproject.entity.Emp;
import com.qfedu.empproject.service.EmpService;
import com.qfedu.empproject.utils.Page;


import java.util.List;

public class EmpServiceImpl implements EmpService {
    private EmpDao empDao = new EmpDaoImpl();
    @Override
    public int update(Emp emp) {
        return empDao.update(emp);
    }

    @Override
    public int delete(Integer id) {
        return empDao.delete(id);
    }

    @Override
    public List<Emp> getEmpsByPage(Page page) {
        return empDao.selectByPage(page.getStartRow(), page.getPageSize());
    }


    @Override
    public long getTotalCount() {
        return empDao.getCount();
    }

    @Override
    public Emp selectByld(String id) {
        return empDao.selectOne(Integer.valueOf(id));
    }

    @Override
    public int addEmp(Emp emp) {
        return empDao.insert(emp);
    }


}
